<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>

<body>
<script src="../layui/layui.js"></script>
<div style="display: none" th:text="${tanchuang}" id="tanchuang"></div>
<table class="layui-hide" id="mypushinfotable" lay-filter="mypushinfotable"></table>
<script type="text/html" id="toolbarDemo" >

</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看详情</a>
</script>
<script th:inline=none>
    layui.use(['table', 'dropdown','form'], function () {
        var table = layui.table;
        var $ = layui.$;
        var form=layui.form
        table.render({
            //表格渲染
            elem: '#mypushinfotable',
            id: 'table1',
            url: '/pushinfo/mypushinfo'
            , response: {
                statusCode: 10000 //规定成功的状态码，默认：0
            }
            , toolbar: '#toolbarDemo'
            ,  height: 'full-0'
            , cellMinWidth: 80,
            limit:20,
            limits:[20]
            , page: true
            , cols: [[
                { type: 'numbers', title: '序号' }, // 添加序号列
                { field: 'name', width: 120, title: '客户姓名' },
                { field: 'sex', width: 80,title: '性别' },
                { field: 'phone', title: '电话'},
                { field: 'wechatAccount', title: '微信账号' },
                { field: 'softwareAccount', title: '软件账号' },
                { field: 'vestedEmployee', title: '授权员工' },
                { field: 'paymentMethod', title: '支付方式' },
                { field: 'paymentTime',width: 180, title: '支付时间' },
                { field: 'addFriendDate', title: '加好友日期' },
                { field: 'customerSituation', title: '客户情况' },
                { field: 'reportDate',width: 180, title: '报告日期' },
                { title: '操作', toolbar: '#barDemo' }
            ]]
            , error: function (res, msg) {
                console.log(res, msg)
            }
            , parseData: function (res) {
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.list //解析数据列表
                };
            },

        });

        table.on('tool(mypushinfotable)', function(obj){
            console.log(obj.data);
            var data = obj.data;
            if(obj.event === 'detail'){
                // console.log("0.0", data)
                layer.open({
                    type: 2,
                    title: '单据展示',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['1200px', '800px'],
                    content: '/pushinfo/pushinfodetailpageforme?id='+data.id
                });
            }
        });

    })
</script>

</body>
</html>